package jpaperwork.meta.transformer.path;

/**
 * User: fleipold
 * Date: Jul 7, 2009
 * Time: 8:28:07 AM
 */
public abstract class PathElementVisitor {
    final public Object visit(PathElement e){
          if (e instanceof FieldPath){
              return visitFieldPath((FieldPath)e);
          }
        if (e instanceof AggregationPath){
            return visitAggreationPath((AggregationPath)e);
        }
        if (e instanceof PolymorhicPath){
            return visitPolymorphicPath((PolymorhicPath)e);
        }
        throw new IllegalArgumentException();
    }

    protected abstract Object visitFieldPath(FieldPath fieldPath);

    protected abstract Object visitAggreationPath(AggregationPath aggregationPath);

    protected abstract Object visitPolymorphicPath(PolymorhicPath polymorhicPath);

}
